Subject: Re: Image Processing
From: [email-masked] (Andy Church)
To: [email-masked]
Date: Tue Dec 05 15:16:08 1995

>However I don't know how to read the luminance from a pixel. All I can
>do is use C=point(x,y) to get an apparently arbitrary colour number. To
>complicate matters the animation is in HAM. Can someone help me with
>this?

  The way I'd do it is this.  First find the R, G, and B values for each
pixel.  Then imagine a cube with a side length of 16 (or 256, depending on
how much color data you have) and, for each pixel, find the "distance"
between the point (0,0,0) and the point (R,G,B); in other words, calculate
sqrt(R*R + G*G + B*B).  That results in a "luminance" value from zero to 16
(or 256).  To save time, you can cut out the square root step and just work
with the square of the luminance.  I don't know whether there's a better
method, or even whether this method is an accepted way of doing this - but
it's what I'd do.  Shrug.

  --Andy Church ([email-masked])
    WWW: http://mmm.mbhs.edu/cgi-bin/achurch/